import { useMemo, useRef } from 'react';
import { AlertDialog } from './alert-dialog';
import type { IAlertDialogProps, IAlertDialogRef } from './alert-dialog';

export const useAlertDialog = () => {
  const ref = useRef<IAlertDialogRef>(null);
  return useMemo(
    () => ({
      alertRef: ref,
      AlertDialog: (props: IAlertDialogProps) => <AlertDialog {...props} ref={ref} />,
    }),
    [],
  );
};
